<template>
	<view>
		<button class="btn" :class="shapeClass"
			:style="{ 'width':width, 'height':height, 'font-size':fontSize,'background':color }"
			@click="handle">{{ lable }}</button>
	</view>
</template>

<script>
	export default {
		name: "MyButton",
		props: {
			lable: {
				type: String,
				default: '按钮'
			},
			shape: {
				type: String,
				default: 'rightAngle',
				validator: function(value) {
					return ['circle', 'square', 'rightAngle'].includes(value);
				}
			},
			width: {
				type: String,
				default: 'auto' // 默认宽度为自动
			},
			height: {
				type: String,
				default: 'auto' // 默认高度为自动
			},
			fontSize: {
				type: String,
				default: '32rpx' // 默认字体大小为16px
			},
			color: {
				type: String,
				default: '#218ef5' // 默认字体大小为16px
			},
		},
		data() {
			return {};
		},
		computed: {
			shapeClass() {
				return {
					'circle': this.shape === 'circle',
					'square': this.shape === 'square',
					'rightAngle': this.shape === 'rightAngle'
				};
			}
		},
		methods: {
			handle() {
				this.$emit('clickBtn');
			}
		}
	};
</script>

<style lang="scss">
	.btn {
		margin-top: 20rpx;
		// background: var(--thorui-color-pink) !important;
		color: #ffffff !important;
	}

	.circle {
		border-radius: 50%;
	}

	.square {
		border-radius: 0;
	}

	.rightAngle {
		border-radius: 10rpx; // 根据需要调整平角的圆角值
	}
</style>